class AuthenticationController < ApplicationController
  def index
  end
  
  def login
    user = User.find_by_login(params[:authentication][:login])
    if user and user.password == params[:authentication][:password]
      #erros.ad_to_base("Login Inválido!!!")
      session[:user_id] = user.id
      redirect_to(:controller => "pii", :action => "index",:notice => "Bem Vindo " + user.name)
    else
      flash[:notice] = "Usuário não encontrado."
      redirect_to :controller => "authentication", :action => "index"
    end
  end
end
